package com.itheima.refect;

import com.itheima.domain.Student;

import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.util.Arrays;

/*
获取所有的成员变量
Field 属性  变量
s  多个
budai s 单个
declared 所有
不带declared public

 */
public class Demo02 {

    public static void main(String[] args) throws Exception {
        //获取字节码对象
        Class<Student> clazz = (Class<Student>) Class.forName("com.itheima.domain.Student");
        Field[] fields = clazz.getFields();
        System.out.println(Arrays.toString(fields));
        Field[] declaredFields = clazz.getDeclaredFields();
        System.out.println(Arrays.toString(declaredFields));


        Field school = clazz.getField("school");


        Field name = clazz.getDeclaredField("name");
        System.out.println(name);
        Field age = clazz.getDeclaredField("age");
        System.out.println(age);




    }
}
